﻿using System.Data.Entity.ModelConfiguration;
using eCommerce.Core.Domain.Brands;
using eCommerce.Core.Domain.Products;

namespace eCommerce.Data.Mapping.Products
{
    public class ItemGroupPictureMapping : EntityTypeConfiguration<ItemGroupPicture>
    {
        public ItemGroupPictureMapping()
        {
            this.ToTable("ItemGroup_Picture_Mapping");
            this.HasKey(pm => pm.Id);

            this.HasRequired(pm => pm.ItemGroup)
                .WithMany(c => c.ItemGroupPictures)
                .HasForeignKey(pm => pm.ItemGroupId);


            this.HasRequired(pc => pc.Picture)
                .WithMany()
                .HasForeignKey(pc => pc.PictureId);

            
        }
    }
}